home *** CD-ROM | disk | FTP | other *** search
- Path: sn.no!usenet
- From: elvemo@sn.no (Rune Elvemo)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Problems with BOOPSI prop gadget
- Date: 10 Jan 1996 19:54:02 GMT
- Organization: SN Internett
- Message-ID: <3395.6583T1242T1959@sn.no>
- NNTP-Posting-Host: sinsen.sn.no
- X-Newsreader: THOR 2.1 (Amiga;TCP/IP beta 5) *UNREGISTERED*
-
- I have a problem when using BOOPSI gadgets.... As far as I am concerned, this
- program should work, but when I compile it, and start it, I can't see the
- gadget..........
-
- What this program is SUPPOSED to do, is to open a window with a prop gadget,
- and the prop gadget will send messages to the program when it changes....
-
-
- /* ------------------------------------------- */
- #include <exec/types.h>
- #include <utility/tagitem.h>
- #include <intuition/intuition.h>
- #include <intuition/screens.h>
- #include <intuition/gadgetclass.h>
- #include <intuition/icclass.h>
-
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
-
- struct Library *IntuitionBase;
-
- struct Window *win;
- struct IntuiMessage *msg;
- struct Gadget *prop;
-
- /* prototype */
- BOOL MakeProp(void);
-
- #define PROPGADID 1L
-
- main()
- {
- struct Screen *pub;
- BOOL NotEnough = FALSE; /* enough mem for prop gadget? */
-
- if (IntuitionBase = OpenLibrary("intuition.library", 37))
- {
- if (pub = LockPubScreen("Workbench"))
- {
- if (win = OpenWindowTags(NULL,
- WA_Left, 0, WA_Top, 0,
- WA_Width, pub->Width,
- WA_Height, pub->Height,
- WA_Flags, WFLG_CLOSEGADGET |
- WFLG_DEPTHGADGET,
- WA_PubScreen, pub,
- WA_Title, "/mi Rulez!",
- WA_IDCMP, IDCMP_CLOSEWINDOW |
- IDCMP_IDCMPUPDATE,
- TAG_END))
- {
- NotEnough = MakeProp();
-
- if (!NotEnough)
- HandleIDCMP();
-
-
- CloseWindow(win);
- }
- else
- printf("Not enough mem for window! sorry!\n");
-
- UnlockPubScreen(NULL, pub);
- }
- else
- printf("Not enough mem for screen, sorry!\n");
-
- CloseLibrary(IntuitionBase);
- }
- else
- printf("not enough memory for IntuitionBase\n");
-
- printf("program quitin'");
- }
-
-
- /* make the propgadget */
- BOOL MakeProp(void)
- {
- BOOL notenough;
-
- if (prop = NewObject(NULL, "propgclass",
- GA_ID, PROPGADID,
- GA_Top, 18,
- GA_Left, 10,
- GA_Width, 10,
- GA_Height, 100,
-
- PGA_Total, 50,
- PGA_Top, 1,
- PGA_Visible, 10,
-
- PGA_NewLook, TRUE,
-
- /* set the window of the program to the target */
- ICA_TARGET, ICTARGET_IDCMP,
-
- TAG_END))
- {
- notenough = FALSE;
- printf("Gadget'en er σpnet!");
- }
- else
- {
- notenough = TRUE;
- }
- return(notenough);
- }
-
- /* Check if there are some IDCMP event at our port */
- HandleIDCMP()
- {
- BOOL done = FALSE;
- ULONG Class;
- APTR IAddress;
- struct TagItem *test;
-
- while (!done)
- {
- WaitPort(win->UserPort);
-
- while (msg = GetMsg(win->UserPort))
- {
- Class = msg->Class;
- IAddress = msg->IAddress;
-
- ReplyMsg(msg);
-
- switch (Class)
- {
- case IDCMP_CLOSEWINDOW:
- done = TRUE;
- break;
- case IDCMP_IDCMPUPDATE:
- test = IAddress;
-
- printf("The Prop is now at: %d\n", IAddress);
- break;
- }
- }
- }
- }
- /* --------------------------------------------- */
-
- Anyone who knows what is wrong with this?
-
- Rune Elvemo
- elvemo@sn.no
- -It's cool to be clear :-)
-
-